<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src="../js/vue.min.js" type="text/javascript" charset="utf-8"></script>
		<style>
			.ball{
				width: 15px;
				height: 15px;
				border-radius: 50%;
				background-color: red;
			}
		</style>
	</head>
	<body>
		<div id="app">
			<input type="button" id="" value="go" @click="falg=!falg"/>
			<transition
				@before-enter="beforeEnter"
				@enter="enter"
				@after-enter="afterEnter"
				>
				<div class="ball" v-show="falg"></div>
			</transition>
		</div>
		<script type="text/javascript">
			new Vue({
				el:"#app",
				data:{
					falg:false
				},
				methods:{
					beforeEnter(el){
						el.style.transform="translate(0,0)"
					},
					enter(el,done){//done是afterEnter的引用，直接调用afterEnter函数
						el.offsetWidth//强制动画刷新
						el.style.transform="translate(150px,450px)"
						el.style.transition="all 1s ease"
						done()
					},
					afterEnter(el){
						this.falg=!this.falg
					}
				}
			});
		</script>
	</body>
</html>
